﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Security;

namespace Infrastructure.Aspect.Authorization
{
    public class AuthorizationService : IAuthorizationService
    {
        public bool Validate(string Rule, System.Security.Principal.IPrincipal principal)
        {            
            Parser parser = new Parser();            
            if (string.IsNullOrEmpty(Rule)) return false;
            return parser.Parse(Rule).Evaluate(principal);  
        }
        
    }
}
